home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / etc / init.d / mountkernfs.sh < prev    next >
Encoding:
Linux/UNIX/POSIX Shell Script  |  2012-03-27  |  1.9 KB  |  84 lines

  1. #! /bin/sh
  2. ### BEGIN INIT INFO
  3. # Provides:          mountkernfs
  4. # Required-Start:
  5. # Required-Stop:
  6. # Should-Start:      glibc
  7. # Default-Start:     S
  8. # Default-Stop:
  9. # Short-Description: Mount kernel virtual file systems.
  10. # Description:       Mount initial set of virtual filesystems the kernel
  11. #                    provides and that are required by everything.
  12. ### END INIT INFO
  13.  
  14. PATH=/sbin:/bin
  15. . /lib/init/vars.sh
  16.  
  17. . /lib/lsb/init-functions
  18. . /lib/init/mount-functions.sh
  19.  
  20. [ -f /etc/default/tmpfs ] && . /etc/default/tmpfs
  21.  
  22. do_start () {
  23.     #
  24.     # Get some writable area available before the root is checked
  25.     # and remounted.
  26.     #
  27.     RW_OPT=
  28.     [ "${RW_SIZE:=$TMPFS_SIZE}" ] && RW_OPT=",size=$RW_SIZE"
  29.     domount tmpfs "" /lib/init/rw tmpfs -omode=0755,nosuid$RW_OPT
  30.     touch /lib/init/rw/.ramfs
  31.  
  32.     # Make pidfile omit directory for sendsigs
  33.     mkdir /lib/init/rw/sendsigs.omit.d/
  34.  
  35.     #
  36.     # Mount proc filesystem on /proc
  37.     #
  38.     domount proc "" /proc proc -onodev,noexec,nosuid
  39.  
  40.     #
  41.     # Mount sysfs on /sys
  42.     #
  43.     # Only mount sysfs if it is supported (kernel >= 2.6)
  44.     if grep -E -qs "sysfs\$" /proc/filesystems
  45.     then
  46.         domount sysfs "" /sys sysfs -onodev,noexec,nosuid
  47.     fi
  48.  
  49.     # Mount /var/run and /var/lock as tmpfs if enabled
  50.     if [ yes = "$RAMRUN" ] ; then
  51.         RUN_OPT=
  52.         [ "${RUN_SIZE:=$TMPFS_SIZE}" ] && RUN_OPT=",size=$RUN_SIZE"
  53.         domount tmpfs "" /var/run varrun -omode=0755,nosuid$RUN_OPT
  54.         touch /var/run/.ramfs
  55.     fi
  56.     if [ yes = "$RAMLOCK" ] ; then
  57.         LOCK_OPT=
  58.         [ "${LOCK_SIZE:=$TMPFS_SIZE}" ] && LOCK_OPT=",size=$LOCK_SIZE"
  59.         domount tmpfs "" /var/lock varlock -omode=1777,nodev,noexec,nosuid$LOCK_OPT
  60.         touch /var/lock/.ramfs
  61.     fi
  62. }
  63.  
  64. case "$1" in
  65.   "")
  66.     echo "Warning: mountkernfs should be called with the 'start' argument." >&2
  67.     do_start
  68.     ;;
  69.   start)
  70.     do_start
  71.     ;;
  72.   restart|reload|force-reload)
  73.     echo "Error: argument '$1' not supported" >&2
  74.     exit 3
  75.     ;;
  76.   stop)
  77.     # No-op
  78.     ;;
  79.   *)
  80.     echo "Usage: mountkernfs [start|stop]" >&2
  81.     exit 3
  82.     ;;
  83. esac
  84.